package com.bestcem.xm.survey.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bestcem.xm.component.mybatis.service.impl.XmServiceImpl;
import com.bestcem.xm.survey.entity.SurveyCondition;
import com.bestcem.xm.survey.mapper.SurveyConditionMapper;
import com.bestcem.xm.survey.service.SurveyConditionService;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.bestcem.xm.survey.util.SurveyConstant.CONDITION_LIMIT;

/**
 * @author guita
 * @description 针对表【ds_survey_condition】的数据库操作Service实现
 * @createDate 2023-01-09 15:15:37
 */
@Service
public class SurveyConditionServiceImpl extends XmServiceImpl<SurveyConditionMapper, SurveyCondition>
        implements SurveyConditionService {

    @Override
    public List<SurveyCondition> condition(String projectId) {
        LambdaQueryWrapper<SurveyCondition> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SurveyCondition::getProjectId, projectId);
        queryWrapper.last("limit " + CONDITION_LIMIT);
        return baseMapper.selectList(queryWrapper);
    }
}




